#include <iostream>
#include <vector>

void select_sort(std::vector<int>& list)
{
    for(int i = 0; i < list.size(); i++)
    {
        int min_val = list[i];
        int min_idx = i;
        for(int j = i+1; j < list.size(); j++)
        {
            if(list[j] < min_val)
            {
                min_val = list[j];
                min_idx = j;
            }
        }
        std::swap(list[i], list[min_idx]);
    }
}

int main()
{
    std::vector<std::vector<int>> list = {
        {},
        {1},
        {1,2},
        {2,1},
        {1,2,3,4},
        {4,3,2,1},
        {4,2,3,1},
        {4,3,1,2,5}
    };

    for(int i = 0; i < list.size(); i++)
    {
        for(auto v : list[i])
            std::cout << v << " ";
        
        select_sort(list[i]);

        std::cout << " --> ";
        for(auto v : list[i])
            std::cout << v << " ";
        std::cout << std::endl;
    }

    return 0;
}